<template>
	<view class="content indexHtml">
		<image class="rightBtn" @tap="toBind('/pages/bind/bind')" src="../../static/img/rightbtn@2x.png" mode=""></image>
		<view class="title">渝中城管网格化系统</view>
		<image class="ajsb" src="../../static/img/ajsb.png" mode="" @tap="toBind('/pages/caseUp/caseUp')"></image>
		<view class="manBox">
			<view class="name">欢迎回来，{{user.userName||user.nickname}}！</view>
			<view class="btn" @tap="toBind('/pages/list/list?type=2')">
				<image class="icon" src="../../static/img/icon1.png" mode=""></image>
				<view class="c">我上报的案件</view>
			</view>
			<view class="btn" @tap="toBind('/pages/list/list?type=1')">
				<image class="icon" src="../../static/img/icon2.png" mode=""></image>
				<view class="c">我处置的案件</view>
			</view>
			<!-- <view class="btn" @tap="clearHc">
				<image class="icon" src="../../static/img/icon2.png" mode=""></image>
				<view class="c">清除缓存</view>
			</view> -->
		</view>
	</view>
</template>

<script>
	import { NetService } from '../../common/NetService';
	export default {
		data() {
			return {
				title: '',
				user: {},
			};
		},
		methods: {

			toBind(url) {
				let u = uni.getStorageSync('user');
				console.log(u)
				if(!u.userID) {
					uni.showToast({
						title: "您未登陆绑定，请登陆"
					});
					setTimeout(function() {
						uni.navigateTo({
							url: "/pages/bind/bind"
						});
					}, 1000);
					return false;
				}
				uni.navigateTo({
					url: url
				});
			},
			toUp() {
				/* */
			},
			clearHc() {
				uni.clearStorageSync();
			},
		},
		onLoad() {
			let _this = this;
			this.$getOpenId(() => {
				_this.user = uni.getStorageSync('user');
				//#ifdef H5
				// 判断是否是微信内
				let en = window.navigator.userAgent.toLowerCase();
				// 匹配en中是否含有MicroMessenger字符串
				if(en.match(/MicroMessenger/i) == 'micromessenger') {
					_this.$share();
				}
				//#endif
			});
		},
		onShow(){
			this.user = uni.getStorageSync('user');
		}
	};
</script>

<style></style>